package com.tanhua.app.controller;

import com.tanhua.app.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class MessageController  {
    @Autowired
    private MessageService messageService;
    @PostMapping(value = "/messages/contacts",name = "添加联系人")
    public ResponseEntity addContacts (@RequestBody Map<String ,String> param){
        Long friendId = Long.valueOf(param.get("userId"));
        return messageService.addContacts(friendId);
    }
    @GetMapping(value = "/messages/contacts",name = "查看联系人")
    public ResponseEntity findContactsByPage(
            @RequestParam(value = "page",defaultValue = "1")Integer pageNum,
            @RequestParam(value = "pagesize",defaultValue = "10")Integer pageSize){
        return messageService.findContactsByPage(pageNum,pageSize);
    }

}
